<template>
  <div class="dress">
    <div style="margin: 10px">服饰：</div>
    <div class="item" v-for="item in dressList" :key="item">
    {{item}}
      <MyButton size="mini" @click="onClick(item)">加入购物车</MyButton>
    </div>
  </div>
</template>

<script>
import MyButton from "../MyButton.vue";
export default {
  name: "Dress",
  components: { MyButton },
  props:['dressList'],
  inject:["products"],
  data() {
    return {};
  },
  methods: {
    onClick(item){
      this.products.push(item)
    }
  },
};
</script>

<style scoped>
.dress {
  display: flex;
}
.item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  border: 1px solid black;
  width: 100px;
  height: 100px;
  margin: 10px;
}
</style>